package com.lm.activiti.controller;

import com.lm.activiti.service.LeaveProcessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/workflow")
public class WorkflowController {

    @Autowired
    private LeaveProcessService leaveProcessService;

    @GetMapping("/deploy")
    public String deploy() {
        leaveProcessService.deployProcess();
        return "流程部署成功！";
    }

    @GetMapping("/start")
    public String start() {
        leaveProcessService.startProcess();
        return "流程实例已启动！";
    }

    @GetMapping("/complete/{assignee}")
    public String complete(@PathVariable String assignee) {
        leaveProcessService.completeTask(assignee);
        return assignee + " 的任务已完成！";
    }
}
